import urllib.request

if __name__ == '__main__':
    url = 'https://weibo.com/set/index'
    headers = {
        'Cookie':'SINAGLOBAL=9666650171115.014.1701827100348; XSRF-TOKEN=8Gg_HpMFN3wiZuFZGMotvm39; PC_TOKEN=a923af78ed; login_sid_t=7214165c639caafb820d0284f8e9dcea; cross_origin_proto=SSL; WBStorage=267ec170|undefined; _s_tentry=weibo.com; Apache=7394649834326.1.1704963265960; ULV=1704963265963:2:1:1:7394649834326.1.1704963265960:1701827100359; wb_view_log=1920*10801; ALF=1707555359; SUB=_2A25Im91PDeThGeFG4lUR-CfMzzmIHXVr2VCHrDV8PUJbkNANLWL4kW1NeHTIuxgWqV4LRXnUQyFb5CRvHkTXtIWj; SUBP=0033WrSXqPxfM725Ws9jqgMF55529P9D9WFhC9d0AM4HAcM3kCjGkOKM5JpX5KzhUgL.FoMR1KM71h.7Sh-2dJLoIp7LxKML1KBLBKnLxKqL1hnLBoMN1h.Nehn4ehBf; WBPSESS=XzJm3wYoL1-fRZN1KQpsPVkNiPlTbEADx3JW59i_GhD_sXGHK4FDuYIeQCnuAf-zdfS8XC8_znLvPJV24TZVcA08orL_t0PX1ade2WvH-IcrCMDqfLASsjkxHlSMkNeVto59tTIKKvl6Cqgxb-QFyg==',
        'Referer':'https://weibo.com/u/7897089045',
        'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0'
    }
    request = urllib.request.Request(url=url,headers=headers)
    opens = urllib.request.urlopen(request)
    com = opens.read().decode('utf-8')
    print(com)
    df = open('../../爬取的文件/wb.html', 'w', encoding='utf-8')
    df.write(com)

